<template>
    <div>
        <p>原字符串{{ msg }}</p>
        <p>{{ reverseText }}</p>
        <input type="text" v-model="kilometers">
        <input type="text" v-model="meters">
    </div>
</template>

<script>
export default {
    data(){
        return{
            msg:'test',
            kilometers:0,
            meters:0,
        }
    },
    methods: {

    },
    computed: {
        reverseText:function() {
            return this.msg.split('').reverse().join('')
        }
    },
    watch:{
        kilometers:function(val) {
            this.kilometers=val;
            this.meters=this.kilometers*1000;
        },
        meters:function(val) {
            this.meters=val;
            this.kilometers=val/1000;
        }
    }
}
</script>

<style>

</style>